<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<!--<meta http-equiv="refresh" content="1" />-->
		<script>
			//定时器
			var s;
		
			//每秒调用输出一次
			function printDate(){
				/*在页面中输出时间*/
				var d = new Date().toLocaleString();
				//document.write(d);
				document.getElementById("t").innerHTML=d;
			}
			
			function stopTime(){
				//清除定时器
				clearInterval(s);
			}
			
			function startTime(){
				s = setInterval(printDate,1000);
			}
			
			//指定延迟执行，执行一次
			setTimeout(printDate,5000);
		</script>
	</head>
	<body>
		<p id="t"></p>
		<button onclick="stopTime()">停止</button>
	</body>
</html>
